<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎页面</title>
    <link href="https://cdn.tailwindcss.com" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }
    </style>
</head>
<body class="flex items-center justify-center">
    <div class="bg-white p-8 md:p-12 rounded-lg shadow-lg text-center max-w-md w-full mx-4">
        <div class="mb-6">
            <div class="w-16 h-16 bg-green-500 rounded-full flex items-center justify-center mx-auto mb-4">
                <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                </svg>
            </div>
            <h1 class="text-3xl font-bold text-gray-800 mb-2">登录成功！</h1>
            <p class="text-gray-600">欢迎访问后台管理系统</p>
        </div>
        
        <div class="bg-gray-50 p-4 rounded-lg mb-6">
            <p class="text-lg font-semibold text-gray-800">
                欢迎 <span id="welcomeUser" class="text-blue-600">用户</span>
            </p>
        </div>
        
        <button onclick="logout()"
            class="w-full bg-red-500 text-white py-3 px-4 rounded-lg hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition duration-200">
            退出登录
        </button>
    </div>

    <script>
        // 从URL参数获取用户名
        const urlParams = new URLSearchParams(window.location.search);
        const username = urlParams.get('user') || '管理员';
        document.getElementById('welcomeUser').textContent = username;

        function logout() {
            fetch('/logout', { method: 'POST' })
                .then(() => {
                    window.location.href = '/';
                })
                .catch(() => {
                    window.location.href = '/';
                });
        }
    </script>
</body>
</html>